from fastadmin.utils.Utils import Utils
import os
from fastadmin.run import app
from fastapi.staticfiles import StaticFiles
from fastadmin.router.router import router
utils = Utils()
# 加载静态文件
def load_static_file():
    static_directory = os.path.join(os.path.dirname(os.path.dirname(__file__)), "public")
    n_list = utils.get_dir_dir(static_directory)
    for lis in n_list:
        app.mount("/"+lis, StaticFiles(directory=static_directory+"/"+lis), name=lis)
# 加载app路由
def load_app_controller():
    app.include_router(router)
def laod_app_middleware():
    import fastadmin.middleware.middleware
    pass
# 加载静态文件
load_static_file()
# 加载app路由
load_app_controller()
# 加载app中间件
laod_app_middleware()